package demo06

/**
 * @author xiaoZhao
 * @date 2022/7/19
 * @describe 并行集合
 */
object Test20_Parallel {
  def main(args: Array[String]): Unit = {
    // 串行
    val result = (1 to 100).map(
      x => Thread.currentThread().getName
    )
    println(result)

    // 并行计算
    val result2 = (1 to 100).par.map(
      x => Thread.currentThread().getId
    )
    println(result2)
  }
}
